﻿#ifndef QGEOCODINGMANAGERENGINECUSTOM_H
#define QGEOCODINGMANAGERENGINECUSTOM_H

#include <QtLocation/QGeoServiceProvider>
#include <QtLocation/QGeoCodingManagerEngine>
#include <QtLocation/QGeoCodeReply>

class QNetworkAccessManager;

class QGeoCodingManagerEngineCustom : public QGeoCodingManagerEngine
{
    Q_OBJECT
public:
    QGeoCodingManagerEngineCustom(const QVariantMap &parameters, QGeoServiceProvider::Error *error, QString *errorString);

public:
    QGeoCodeReply* geocode          (const QGeoAddress& address, const QGeoShape& bounds) override;
    QGeoCodeReply* geocode          (const QString& address, int limit, int offset, const QGeoShape& bounds) override;
    QGeoCodeReply* reverseGeocode   (const QGeoCoordinate& coordinate, const QGeoShape& bounds) override;

private slots:
    void _replyFinished();
    void _replyError(QGeoCodeReply::Error errorCode, const QString& errorString);

private:
    QNetworkAccessManager* _networkManager;
    QByteArray _userAgent;
};

#endif // QGEOCODINGMANAGERENGINECUSTOM_H
